package com.atguigu.guli.service.cms.controller.api;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.cms.entity.Ad;
import com.atguigu.guli.service.cms.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/cms/ad")

public class ApiAdController {
    @Autowired
    private AdService adService ;
    //查询首页热门广告banner数据
    @GetMapping("getBanners")
    public R getBanners() {
        List<Ad> ads = adService.getBanners() ;
        return R.ok().data("items",ads) ;
    }
}
